<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div>判断一个整数大于0 ，等于0小于0</div> 
    <input type="text" id="num1"><button id="btn">查询</button>
    <script>
        var num1 = document.getElementById("num1");
        var btn = document.getElementById("btn");
        btn.onclick = function () {
            var res = parseInt(num1.value);
            if ( res > 0 ) {
                window.alert( res + "大于0");
                num1.value = null;
            } else if ( res == 0 ) {
                window.alert( res + "等于0");
                num1.value = null;
            } else if ( res < 0 ) {
                window.alert( res + "小于0");
                num1.value = null;
            } else {
                window.alert("输入数据不符合规范");
                num1.value = null;
            }
        }
    </script>
</body>
</html>